package com.example.edu.Mapper;

import com.example.edu.Entity.User;
import org.apache.ibatis.annotations.*;

@Mapper
public interface UserMapper {
    @Select("select * from user where telephone = #{telephone}")
    User getUser(@Param("telephone") String telephone);

    @Insert("insert into user(telephone, password, nik_name, role) VALUES (#{user.telephone},#{user.password},#{user.nik_name},#{user.role})")
    @Options(useGeneratedKeys = true, keyProperty = "user_id") // 自动获取主键
    void addUser(@Param("user") User user);
}
